<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="kissdata">


    <meta name="subtitle" content="人生笔记">


    <meta name="description" content="南邮计算机学院2021毕业生王鹏的介绍，cs软件工程专业">


    <meta name="keywords" content="wangpeng 王鹏 南邮 南京">


<title>Go 起步 | 王鹏的小岛</title>



    <link rel="icon" href="/myIcon.ico">




    <!-- stylesheets list from _config.yml -->
    
    <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
    <script src="/js/script.js"></script>
    
    <script src="/js/tocbot.min.js"></script>
    



    
    
        <!-- MathJax配置，可通过单美元符号书写行内公式等 -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
    "HTML-CSS": {
        preferredFont: "TeX",
        availableFonts: ["STIX","TeX"],
        linebreaks: { automatic:true },
        EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
    },
    tex2jax: {
        inlineMath: [ ["$", "$"], ["\\(","\\)"] ],
        processEscapes: true,
        ignoreClass: "tex2jax_ignore|dno",
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
        equationNumbers: { autoNumber: "AMS" },
        noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } },
        Macros: { href: "{}" }
    },
    messageStyle: "none"
    });
</script>
<!-- 给MathJax元素添加has-jax class -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>
<!-- 通过连接CDN加载MathJax的js代码 -->
<script type="text/javascript" async
        src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script>


    


<meta name="generator" content="Hexo 7.0.0"></head>

<body>
    <script>
        // this function is used to check current theme before page loaded.
        (() => {
            const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
            const isDark = currentTheme === 'dark';
            const pagebody = document.getElementsByTagName('body')[0]
            if (isDark) {
                pagebody.classList.add('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Dark"
            } else {
                pagebody.classList.remove('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Light"
            }
        })();
    </script>

    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">侠之大者</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/update/mystate">Career</a>
                
                    <a class="menu-item" href="/category">Legend</a>
                
                    <a class="menu-item" href="/about">Me</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">侠之大者</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/update/mystate">Career</a>
                
                    <a class="menu-item" href="/category">Legend</a>
                
                    <a class="menu-item" href="/about">Me</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
            <div class="main">
                <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">Expand all</a>
        <a onclick="go_top()">Back to top</a>
        <a onclick="go_bottom()">Go to bottom</a>
    </div>
</div>

<script>
    var tocbot_timer;
    var DEPTH_MAX = 6; // 为 6 时展开所有
    var tocbot_default_config = {
        tocSelector: '.tocbot-list',
        contentSelector: '.post-content',
        headingSelector: 'h1, h2, h3, h4, h5',
        orderedList: false,
        scrollSmooth: true,
        onClick: extend_click,
    };

    function extend_click() {
        clearTimeout(tocbot_timer);
        tocbot_timer = setTimeout(function() {
            tocbot.refresh(obj_merge(tocbot_default_config, {
                hasInnerContainers: true
            }));
        }, 420); // 这个值是由 tocbot 源码里定义的 scrollSmoothDuration 得来的
    }

    document.ready(function() {
        tocbot.init(obj_merge(tocbot_default_config, {
            collapseDepth: 1
        }));
    });

    function expand_toc() {
        var b = document.querySelector('.tocbot-toc-expand');
        var expanded = b.getAttribute('data-expanded');
        expanded ? b.removeAttribute('data-expanded') : b.setAttribute('data-expanded', true);
        tocbot.refresh(obj_merge(tocbot_default_config, {
            collapseDepth: expanded ? 1 : DEPTH_MAX
        }));
        b.innerText = expanded ? 'Expand all' : 'Collapse all';
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

    function obj_merge(target, source) {
        for (var item in source) {
            if (source.hasOwnProperty(item)) {
                target[item] = source[item];
            }
        }
        return target;
    }
</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">Go 起步</h1>
            
                <div class="post-meta">
                    
                        Author: <a itemprop="author" rel="author" href="/">kissdata</a>
                    

                    
                        <span class="post-time">
                        Date: <a href="#">Oct 17, 2023&nbsp;&nbsp;0:00</a>
                        </span>
                    
                    
                        <span class="post-category">
                    Category:
                            
                                <a href="/categories/Review/">Review</a>
                            
                        </span>
                    
                </div>
            
        </header>

        <div class="post-content">
            <blockquote>
<p>介绍 Go 教材和学习方式， 记住 <strong>不要贪多</strong>。</p>
</blockquote>
<p>go 主流教材有两本，《Go入门指南》名气更大点，大概 200 个小章节。。</p>
<h2 id="《Go入门指南》"><a href="#《Go入门指南》" class="headerlink" title="《Go入门指南》"></a>《Go入门指南》</h2><p>原作者地址 &sect;  <code>Github</code>  <a target="_blank" rel="noopener" href="https://github.com/unknwon/the-way-to-go_ZH_CN">unknwon&#x2F;the-way-to-go_ZH_CN</a></p>
<p>其他在线阅读 &sect; 书栈网  <a target="_blank" rel="noopener" href="https://www.bookstack.cn/read/the-way-to-go_ZH_CN/eBook-directory.md">目录 - BookStack</a> （更新至 21年6月）</p>
<p><img src="/pic/go1.png"></p>
<ul>
<li>Go技术论坛&ensp; <a target="_blank" rel="noopener" href="https://learnku.com/docs/the-way-to-go/book-intro/3560">基础信息</a>   <code>learnku.com</code> </li>
<li>Go中文网 &emsp; <a target="_blank" rel="noopener" href="https://books.studygolang.com/the-way-to-go_ZH_CN/">Go入门指南</a>  <code>studygolang.com</code></li>
</ul>
<blockquote>
<p>好多网站都挂了它可以在线阅读，但修订后都没有更新，过时。建议看原github，或者书栈网的较好，也是我的 XW导师 推荐的。</p>
</blockquote>
<h2 id="《Go语言圣经》"><a href="#《Go语言圣经》" class="headerlink" title="《Go语言圣经》"></a>《Go语言圣经》</h2><p>简称 <code>gopl</code> ，有两个版本，在线阅读的是柴树杉版，原来官网不可能看，要去各种镜像页学习，22年8月有大调整，可直接看  <a target="_blank" rel="noopener" href="https://gopl-zh.github.io/">Go语言圣经</a> </p>
<p>【原作者地址】 <a target="_blank" rel="noopener" href="https://github.com/gopl-zh/gopl-zh.github.com"><code>Github</code></a></p>
<p><img src="/pic/learn_gopl.png"></p>
<p>还有一个是黑皮书，李道兵版本。</p>
<p>注意 gopl 的demo配置，和书上介绍的有点区别</p>
<h3 id="附-配置方法"><a href="#附-配置方法" class="headerlink" title="附 配置方法"></a>附 配置方法</h3><ol>
<li><p>找到 gopl 的代码库URL ☞  <a target="_blank" rel="noopener" href="https://github.com/adonovan/gopl.io/"><em>The Go Programming Language</em></a></p>
</li>
<li><p>将示例克隆到本地。Git 输入 <code>git clone https://github.com/adonovan/gopl.io.git</code></p>
</li>
</ol>
<img src="gopl_demo1.png" >

<p>此时文件夹下有一个 mod 和13个代表每个章节的子文件夹，全部项目只有这一个mod 没有其他mod了。</p>
<ol start="3">
<li>VS Code 打开子文件夹的程序文件夹（Go的一个程序就要一个文件夹专门存放）。</li>
</ol>
<img src="gopl_demo2.png" alt="VS Code打开demo">

<p>项目里只有一个main.go 程序，打开终端，输入运行命令(不用 go mod)，或者先 go build再运行二进制exe文件，像运行C语言那样。</p>
<img src="gopl_demo3.png" alt="VS Code打开demo">

<p>其他项目同此步骤。</p>
<hr>
<p>！！！不要贪多</p>

        </div>

        
            <section class="post-copyright">
                
                
                
                
                     <p class="copyright-item">
                         <span>Slogan:</span>
                         <span>人生三大错觉：我躲得过去，我能反杀，是不是<strong>喜欢我?</strong></span>
                     </p>
                

            </section>
        
        <section class="post-tags">
            <div>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
                <span>· </span>
                <a href="/">home</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2023/10-30/knowledge_c/">C 可变长参数的应用</a>
            
            
            <a class="next" rel="next" href="/2023/10-8/ability_mylevel/">我的IT水平</a>
            
        </section>


    </article>
</div>

            </div>
            <footer id="footer" class="footer">
    <div class="copyright">
        <span>187-9597-5517 &nbsp; 王鹏 @ <a href="https://cs.njupt.edu.cn/" target="_blank">njupt</a</span>
    </div>
</footer>

    </div>
</body>

</html>